<?php

namespace ManiaLivePlugins\MLEPP\Widgets\Widgets\VHelpers;

class DynamicTab extends \ManiaLive\Gui\Windowing\Controls\Tab {

    public $label;
       
    function initializeComponents() {
            $this->label = new \ManiaLib\Gui\Elements\Label($this->sizeX, $this->sizeY);
            $this->label->enableAutonewline();
            $this->label->setMaxline(7);
            $this->label->setStyle("TextRaceChat");
            $this->addComponent($this->label);
    }
    
    public function updateTab() {
        $this->clearComponents();
        $this->addComponent($this->label);
    }
    
    public function setText($text) {
        $this->label->setText($text);    
        $this->updateTab();
    }
    
     function destroy() {
        parent::destroy();
        gc_collect_cycles();
    }    
	
    function onActivate() {
        $title = \ManiaLib\Utils\TMStrings::stripColors($this->getTitle());
        $this->setTitle('$fff'.$title);
		$this->redraw();
    }
	function onDeactivate() {
       /* $title = \ManiaLib\Utils\TMStrings::stripColors($this->getTitle());
        $this->setTitle('$fff'.$title);     
		$this->redraw();
		*/
    }

}
?>